this is how I used to used it in common modules.
const debuger=require('debug')("namespace")
I set an environmental variable DEBUG="namespace" and when i start the app, i can use the debugger.
However I could not figure out how to use it with import/export staments.
import debugger from "debug" // how can i pass () here
You can do:
import debug from 'debug';
const logger = debug('namespace');
logger('Starting App');
Actually, as the npm debug module exports a function directly (module.exports = (params) => {...), you can give the function whatever name you like, for example:
import createDebugMessages from 'debug';
const debug = createDebugMessages('namespace');
debug('Starting App');
This way, the original syntax for debugging does not even need to be changed.